If we use a regular idle watch, any session inhibitors can prevent the
watch from triggering, leading to the break manager to never consider
the break as having been completed until the inhibitor is gone. This
could lead to situations in which the system appears to be stuck with
a dimmed screen.
Also start the idle time when the idle watch is created, otherwise any
previous idle time would count towards it, causing the watch to trigger
early, leaving it inconsistent with the rest of the break manager state.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8378
(cherry picked from commit
b2e5a125ae8bf682b0d54d925ce8fdf26680b48e)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4058>
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
+import Meta from 'gi://Meta';
import Shell from 'gi://Shell';
import St from 'gi://St';
}
_startStateMachine() {
- this._idleWatchId = this._idleMonitor.add_idle_watch(MIN_BREAK_LENGTH_SECONDS * 1000, this._onIdleWatch.bind(this));
+ this._idleWatchId = this._idleMonitor.add_idle_watch_full(
+ MIN_BREAK_LENGTH_SECONDS * 1000,
+ this._onIdleWatch.bind(this),
+ Meta.IdleMonitorWatchFlags.UNINHIBITABLE | Meta.IdleMonitorWatchFlags.START_NOW);
this._state = BreakState.ACTIVE;
this._currentBreakType = null;
// simulated clock and event queue.
get mockIdleMonitor() {
return {
- add_idle_watch: (waitMsec, callback) => {
+ add_idle_watch_full: (waitMsec, callback, _flags) => {
console.assert(this._idleWatch === null);
this._idleWatch = {
waitMsec,